//
//  OSCUser.m
//  oschina_song
//
//  Created by song on 16/2/18.
//  Copyright © 2016年 song. All rights reserved.
//

/**
 
 <user>
 <uid>259430</uid>
 <location><![CDATA[内蒙古 呼和浩特]]></location>
 <name><![CDATA[ziying]]></name>
 <followers>1</followers>
 <fans>0</fans>
 <score>5</score>
 <portrait>http://static.oschina.net/uploads/user/129/259430_100.jpg?t=1369204401000</portrait>
 <favoritecount>361</favoritecount>
 <gender>1</gender>
 </user>
 
 
 **/


#import "OSCUser.h"

@implementation OSCUser


-(instancetype)initWithXML:(ONOXMLElement *)xml
{
    self = [super init];
    if(self)
    {
        _userID = [[[xml firstChildWithTag:@"uid"] numberValue] longLongValue];
        _location = [[xml firstChildWithTag:@"location"] stringValue];
        _name = [[xml firstChildWithTag:@"name"] stringValue];
        
        _followersCount  = [[[xml firstChildWithTag:@"followers"] numberValue] intValue];
        _fansCount = [[[xml firstChildWithTag:@"fans"] numberValue] intValue];
        _score =[[[xml firstChildWithTag:@"score"] numberValue] intValue];
        _portraitURL =[NSURL URLWithString:[[xml firstChildWithTag:@"portrait"] stringValue]] ;
        _favoriteCount = [[[xml firstChildWithTag:@"favoritecount"] numberValue] intValue];
        _gender  = [[[xml firstChildWithTag:@"gender"] stringValue] copy];
    }
    
    return  self;
}

@end
